/******************************************************
  site base
******************************************************/
* {
  box-sizing: border-box;
}

body {
  background-color: #fff;
  line-height: 1.6;
  margin: 0;
  padding: 0;
  overflow-wrap: break-word;
}

body, input, button {
  font-family: "Roboto", sans-serif;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
}

button {
  cursor: pointer;
  border: none;
}

button.pub-button {
  font-size: 13px;
  margin: 20px;
  padding: 12px 24px;
  font-weight: 500;
  color: white;
  background: $color-input-primary;
  border-radius: 2px;
  outline: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .5);

  &:hover {
    background-color: darken($color-input-primary, 10%);
  }
}

a {
  text-decoration: none;
  color: $color-link;
  cursor: pointer;
  font-weight: 500;
  opacity: 1;

  &:hover {
    opacity: 0.8;
  }
}

main {
  max-width: $site-max-width;
  margin: 0 auto;
  padding: 0 20px;
}
// TODO: replace searchbar's 'main' element with something non-main
body > main {
  min-height: calc(100vh - 360px); // top nav + search banner + footer margin + footer padding
}

code {
  background: #f8f8f8;
  border: 1px solid #eee;
  font-family: "Source Code Pro", Menlo, monospace;
  font-size: 85%;
  padding: 2px;
}

pre > code {
  display: block;
  overflow-x: auto;
  padding: 0.5em;
}

._flex-space {
  -webkit-box-flex: 1;
  -ms-flex: 1;
  flex: 1;
}

._banner-bg {
  background: $color-searchbar-dark-bg;
  background-image: url('../img/background-pattern-darkblue.jpg?hash=tqigd6sddnrgq97c7crv8d2l6agjtrob');
  background-size: cover;
  color: $color-searchbar-dark-fg;

  a {
    color: $color-searchbar-dark-link;
  }
}

/*
 * Hide only visually, but have it available for screen readers:
 * http://snook.ca/archives/html_and_css/hiding-content-for-accessibility
 */
._visuallyhidden {
  border: 0;
  clip: rect(0 0 0 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
}

._visuallyhidden:active,
._visuallyhidden:focus {
  clip: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  position: static;
  width: auto;
}

.overflow-x {
  overflow-x: auto;
}

/******************************************************
  site header
******************************************************/
.site-header-row {
  background: $color-header-dark-bg;
  color: $color-header-dark-fg;
}

.site-header {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;

  max-width: $site-max-width;
  margin: 0 auto;
}

.site-header > .hamburger {
  display: none;
  background-color: transparent;
  width: 24px;
  height: 40px;
  background-position: center;
  margin-left: 10px;
  background-image: url('');
  background-size: 100%;
  background-repeat: no-repeat;
}

.nav-wrap {
  display: flex;
  justify-content: space-between;
  width: 100%;
  align-items: center;
  height: 50px;

  &.-show {
    display: block;
  }
}

.site-nav {
  display: -webkit-inline-box;
  display: -ms-inline-flexbox;
  display: inline-flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
}

.site-nav {
  margin: 0 10px;
  font-size: 14px;
  text-transform: capitalize;
  vertical-align: middle;
  padding: 12px 10px;
}

.nav-header {
  display: -webkit-inline-box;
  display: -ms-inline-flexbox;
  display: inline-flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  height: 40px;
}

.nav-header > .logo.-hidden {
  display: none;
}

.nav-header > .logo img {
  height: 27px;
  margin-left: 16px;
  vertical-align: middle;
}

.nav-header > .close {
  display: none;
}

.sub-wrap {
  position: relative;

  > .button {
    padding: 8px 10px;
    margin-left: 10px;
    font-size: 14px;
    text-transform: capitalize;
    vertical-align: middle;
    font-weight: 500;
    color: inherit;
    background-color: transparent;

    &:after {
      content: "";
      background-image: url("data:image/svg+xml, %3Csvg xmlns='http://www.w3.org/2000/svg' width='24px' height='24px' viewBox='0 0 24 24' fill='%23757575'%3E %3Cpath d='M7.41 7.84L12 12.42l4.59-4.58L18 9.25l-6 6-6-6z'/%3E %3Cpath d='M0-.75h24v24H0z' fill='none'/%3E %3C/svg%3E ");
      display: inline-block;
      width: 24px;
      height: 24px;
      vertical-align: middle;
    }
  }

  /* open sub nav */
  &:hover .sub-nav,
  &.hover .sub-nav {
    display: block;
  }
}

.sub-nav {
  display: none;
  position: absolute;
  text-align: left;
  background: #fff;
  border: 1px solid #ddd;
  min-width: 200px;
  padding: 8px 12px;
  border-radius: 3px;
  top: 40px;
  cursor: auto;
  cursor: initial;
  font-size: 14px;
  z-index: 2;
  /* using 2 pesudo element to create a bordered triangle */

  &.sub-nav-right {
    text-align: right;
    right: 0px;

    &:before,
    &:after {
      right: 4px;
    }
  }

  &:before {
    content: "";
    position: absolute;
    top: -10px;
    width: 2px;
    height: 0;
    border-width: 0 10px 10px;
    border-style: solid;
    border-color: transparent transparent #ddd;
  }

  &:after {
    content: "";
    position: absolute;
    top: -8px;
    width: 2px;
    height: 0;
    border-width: 0 10px 10px;
    border-style: solid;
    border-color: transparent transparent #fff;
  }

  > .link,
  > .command {
    display: block;
  }

  > .link {
    color: #000;
    padding: 3px 0;
    font-weight: 400;
    text-transform: none;

    &:hover {
      color: #0175C2;
    }
  }

  > .command {
    display: inline-block;
    color: #000;
    text-transform: none;
    background: #f5f5f5;
    border: 1px solid #ddd;
    padding: 0 6px;
    margin: 3px 0;
    color: #de0e32;
  }

  > .title {
    color: #999;
    text-transform: uppercase;
    font-size: 12px;
    font-weight: 600;
    margin: 4px 0;
  }
}

.command-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

/********************* mobile header ********************/
@media screen and (max-width: 640px) {
  .site-header > .mask {
    display: none;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.5);
  }

  .site-header > .mask.-show {
    display: block;
  }

  .site-header > .hamburger {
    display: block;
  }

  .nav-wrap {
    display: block;
    width: inherit;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    height: 100%;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.7);
    background: #f5f5f5;
    transition: -webkit-transform 0.3s ease;
    transition: transform 0.3s ease;
    transition: transform 0.3s ease, -webkit-transform 0.3s ease;
    -webkit-transform: translateX(-100%);
    transform: translateX(-100%);
    min-width: 270px;
    z-index: 1;
  }

  .nav-wrap.-show {
    -webkit-transform: translateX(0);
    transform: translateX(0);
  }

  .site-nav {
    position: absolute;
    top: 66px;
    bottom: 0;
    left: 0;
    right: 0;
    padding-bottom: 50px;
    display: block;
    overflow: auto;
  }

  .site-nav > .link {
    display: block;
    text-align: left;
  }

  .site-nav > .link:after {
    content: ">";
    margin-left: 6px;
  }

  .nav-header {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    background: $color-header-dark-bg;
    height: 56px;
  }

  .nav-header > .close {
    display: block;
    width: 24px;
    height: 24px;
    margin-right: 10px;
    float: right;
    background-color: transparent;
    background-size: 100%;
    background-repeat: no-repeat;
    background-image: url();
  }

  .nav-header > .logo {
    display: block !important;
  }

  /* hide the down arrow */
  .sub-wrap > .button {
    cursor: default;
    margin: 10px 10px 6px;
  }

  .sub-wrap > .button:after {
    display: none;
  }

  .sub-nav {
    position: static;
    display: block;
    background-color: transparent;
    border: none;
    padding: 0 36px;
  }

  .sub-nav:before, .sub-nav:after {
    display: none;
  }

  .sub-nav > .title {
    display: none;
  }

  .sub-nav > .link {
    margin: 6px 0;
  }

  .site-footer {
    padding: 0;
  }

  .site-footer > .link {
    display: block;
  }
}
.center {
  text-align: center;
}
